﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
    xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Create CommandManager Framework</Title>
      <Author>Teacher彭</Author>
      <Description>创建命令管理器代码框架</Description>
      <Shortcut>cmd</Shortcut>
    </Header>
    <Snippet>
      <Code Language="CSharp">
        <![CDATA[#region 命令管理器

        private CommandPatternManager _CommandManager = new CommandPatternManager();

        private void OnUndo_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this.Exec(_CommandManager.Undo);
        }

        private void OnUndo_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = _CommandManager.CanUndo;
        }

        private void OnRedo_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this.Exec(_CommandManager.Redo);
        }

        private void OnRedo_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = _CommandManager.CanRedo;
        }

        #endregion
]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
